<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
	contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>驴友网-公告管理</title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
</head>
<body>
	<div class="panel admin-panel">
		<div class="panel-head">
			<strong class="icon-reorder"> 公告列表</strong>
		</div>
		<div class="padding border-bottom"></div>
		<table class="table table-hover text-center">
			<tr>
				<th width="5%">ID</th>
				<th>公告内容</th>
				<th>发布时间</th>
				<th width="250">操作</th>
			</tr>

			<%--循环遍历公告信息 --%>
			<c:forEach var="notice" items="${sessionScope.notice }"
				varStatus="status">
				<tr>
					<td>${status.count }</td>
					<td>${notice.notice }</td>
					<td>${notice.updatetime }</td>
					<td>
						<div class="button-group">
							<a type="button" class="button border-main" href="#"
								onclick="return update('${notice.noticeId}')"><span
								class="icon-edit"></span>修改</a> <a class="button border-red"
								href="<c:url value='/deleteNoticeServelt'/>?noticeId=${notice.noticeId}"
								onclick="return del()"><span class="icon-trash-o"></span> 删除</a>
						</div>
					</td>
				</tr>
			</c:forEach>
		</table>
		<div class="panel-head"></div>
		<div class="padding border-bottom"></div>
	</div>
	<script>
		function del() {
			if (confirm("您确定要删除吗?")) {
				return true;
			} else {
				return false;
			}
	
		}
		function update(id) {
			if (confirm("您确定要修改吗?")) {
			    
				$('#noticeID').val(id);
				$("#textDiv").show();
			
			} else {
				return false;
			}
	
		}
	</script>
	<div class="panel admin-panel margin-top" style="display:none" id="textDiv">
		<div class="panel-head" id="add">
			<strong><span class="icon-pencil-square-o"></span>修改公告</strong>
		</div>
		<div class="body-content">
			<form method="post" class="form-x" action="<c:url value='/alterNoticeServlet'/>">
				<div class="form-group">
					<div class="label">
						<label>待修改公告ID：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" name="noticeID" value=""
							readonly="readonly"   id="noticeID" required="required"/>
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>公告内容：</label>
					</div>
					<div class="field">
						<input type="text" class="input w50" name="content" value="" placeholder="此处输入内容"
							required="required"/>
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label></label>
					</div>
					<div class="field">
						<button class="button bg-main icon-check-square-o" type="submit">
							提交</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
</html>